import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';

export default (self) => [
    {
        title: '服务名称',
        name: 'name',
        tableItem: {},
        searchItem: {
            group: 'abc'
        },
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入服务名称'
                }
            ]
        },
    },
    {
        title: '服务代码(唯一)',
        name: 'code',
        tableItem: {},
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入服务代码'
                }
            ]
        },
    },
    {
        title: '服务电话',
        name: 'phone',
        tableItem: {},
        formItem: {},
    },
    {
        title: '描述',
        name: 'describe',
        tableItem: {},
        formItem: {
            type: 'textarea',
            rows: 5
        }
    },
    {
        title: '直接上传',
        name: 'image_arr',
        formItem: {
            type: 'upload',
            listType: 'picture',
            action: '/system/upload/?savePath=article', // 后台接口 例：/uploadFile 会走代理
            fileName: 'file', // 后台接收的名字
            rules: [
                {
                    required: true,
                    message: '请选择图片'
                }
            ],
            maxFileSize: 1000, // 最大限制 kb
            max: 1
        }
    },
    {
        title: '操作',
        tableItem: {
            width: 90,
            fixed: 'right',
            render: (text, record) => (
                <DataTable.Oper>
                    <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
                        <Icon type="edit" />
                    </Button>
                    <Button tooltip="删除" onClick={e => self.onDelete(record)}>
                        <Icon type="trash" />
                    </Button>
                </DataTable.Oper>
            )
        }
    }
];
